﻿@model IList<WebVideo.EntityVideo>

@{ 
    if(@Model.Count() != 0)
    {
        
		if (System.Web.HttpContext.Current.Request.Cookies["userId"] != null)
		{
			int i = 0;
			foreach (var item in Model)
			{
                string imgct = "~/Content/Images/Avatar/" + item.EntityBusiness.Avatar;
                string imgvs = "~/Content/Images/Video/" + item.Image;
				if (i == 0)
				{ 
					<div class="widget _2x2" style="overflow:hidden;">
					
							<a href="@Url.Action("NView", "Index", new { IdVideo = @item.Id })">
								<img src="@Url.Content(imgvs)"/>
							</a>                    
					   <div class="description"> 
								<h2>@Html.ActionLink(@item.Name, "NView", new { IdVideo = @item.Id })</h2>      
							<p class="vote _4">View: <span>@item.Viewed</span></p>
							<p class="company">
								<img src="@Url.Content(imgct)" /><span>@item.EntityBusiness.CompanyName</span>
							</p>
						</div>

						<!--/ description-->
					</div>
				}
				else if (i == 1 || i == 6)
				{
					<div class="widget _2x1"  style="overflow:hidden;" >
		   
							<a href="@Url.Action("NView", "Index", new { IdVideo = @item.Id })">
								<img src="@Url.Content(imgvs)"/>
							</a>   

				   
						<div class="description">
							<h2>@Html.ActionLink(@item.Name, "NView", new { IdVideo = @item.Id })</h2>
							<p class="vote _4">View: <span>@item.Viewed</span></p>
							<p class="company">
								<img src="@Url.Content(imgct)" /><span>@item.EntityBusiness.CompanyName</span>
							</p>
						</div>

						<!--/ description-->
					</div>
				}
				else
				{
					<div class="widget"  style="overflow:hidden;">

							<a href="@Url.Action("NView", "Index", new { IdVideo = @item.Id })">
								<img src="@Url.Content(imgvs)"/>
							</a>   
						<div class="description">
							<h2>@Html.ActionLink(@item.Name, "NView", new { IdVideo = @item.Id })</h2>

							<p class="vote _4">View: <span>@item.Viewed</span></p>
							<p class="company">
								<img src="@Url.Content(imgct)" /><span>@item.EntityBusiness.CompanyName</span>
							</p>
						</div>
						<!--/ description-->
					</div>
				}
				i++;
			}
			<div class="widget bg-color-ForestGreen "  style="overflow:hidden;">
				<a href="@Url.Action("AllVideo", "Index")" class="inner-wg">
					<span class="img"><span><img src="Content/cssFrontEnd/images/icon_movie.png" /></span></span>
					<span class="title">Tất cả video</span>
				</a>
			</div> 
		}
		else if (System.Web.HttpContext.Current.Request.Cookies["userId"] == null)
		{
			int i = 0;
			foreach (var item in Model)
			{
                string imgct = "~/Content/Images/Avatar/" + item.EntityBusiness.Avatar;
                string imgvs = "~/Content/Images/Video/" + item.Image;
				if (i == 0)
				{ 
					<div class="widget _2x2" id ="widget1" style="overflow:hidden;">
					
							<a href="@Url.Action("NView", "Index", new { IdVideo = @item.Id })">
								<img src="@Url.Content(imgvs)"/>
							</a>                    
					   <div class="description"> 
								<h2>@Html.ActionLink(@item.Name, "NView", new { IdVideo = @item.Id })</h2>      
							<p class="vote _4">View: <span>@item.Viewed</span></p>
							<p class="company">
								<img src="@Url.Content(imgct)" /><span>@item.EntityBusiness.CompanyName</span>
							</p>
						</div>

						<!--/ description-->
					</div>
				}
				else if (i == 1 || i == 6)
				{
					<div class="widget _2x1" id ="widget2"  style="overflow:hidden;">
		   
							<a href="@Url.Action("NView", "Index", new { IdVideo = @item.Id })">
								<img src="@Url.Content(imgvs)"/>
							</a>   

				   
						<div class="description">
							<h2>@Html.ActionLink(@item.Name, "NView", new { IdVideo = @item.Id })</h2>
							<p class="vote _4">View: <span>@item.Viewed</span></p>
							<p class="company">
								<img src="@Url.Content(imgct)" /><span>@item.EntityBusiness.CompanyName</span>
							</p>
						</div>

						<!--/ description-->
					</div>
				}
				else
				{
					<div class="widget" id ="widget3"  style="overflow:hidden;">

							<a href="@Url.Action("NView", "Index", new { IdVideo = @item.Id })">
								<img src="@Url.Content(imgvs)"/>
							</a>   

				   

						<div class="description">
							<h2>@Html.ActionLink(@item.Name, "NView", new { IdVideo = @item.Id })</h2>

							<p class="vote _4">View: <span>@item.Viewed</span></p>
							<p class="company">
								<img src="@Url.Content(imgct)" /><span>@item.EntityBusiness.CompanyName</span>
							</p>
						</div>
						<!--/ description-->
					</div>
				}
				i++;
			}
			<div class="widget bg-color-ForestGreen" id="widgetall" style="overflow:hidden;">
				<a href="@Url.Action("AllVideo", "Index")" class="inner-wg">
					<span class="img"><span><img src="../Content/cssFrontEnd/images/icon_movie.png" /></span></span>
					<span class="title">Tất cả video</span>
				</a>
			</div>
			<script type="text/javascript">
					  $(document).ready(function () {
					      $('#widget1,#widget2,#widget3').click(function (e) {
							  e.preventDefault();
							  $('#frmLoginn, #widget _2x1').modal('show');
						  });
			});</script>       
		}
		
    }
    else
    {
        <div class="inner-container" id="inner-container" style="width:8000px">
            <div class="wrap-widget">
            	<div class="inner-widget _3">
                    <div class="widget _3x1 phone bg-color-ForestGreen">
                    	<div class="widgetMsg">
                            <div class="pull-left"><img src="@Url.Content("~/Content/cssFrontEnd/images/icon-msg-success.png")" /></div>
                            <p>Chúc mừng bạn. <br />
                          Bạn đã xem hết video trong ngày hôm nay!</p>
                        </div>
                    </div><!--/ .widget-->
                </div><!--/ .inner-widget-->
            </div><!--/ .wrap-widget -->
    </div><!--/ .inner-container-->
    }
 }

@section occasionalScripts {
    <script type="text/javascript" src="@Url.Content("~/Content/cssFrontEnd/js/jquery.min.js")" ></script>
    <script type="text/javascript" src="@Url.Content("~/Content/cssFrontEnd/js/load.js")" ></script>
    <script type="text/javascript" src="@Url.Content("~/Content/cssFrontEnd/js/styles.js")" ></script>
    <script type="text/javascript" src="@Url.Content("~/Content/cssFrontEnd/js/jquery.nicescroll.min.js")" ></script>
    

}
<style>
    .widget .description .company img{ width: 35px !important; height: 35px !important; margin-right: 5px; float:left;}
</style>